package com.example.springbootopenfeign.controller;

import com.example.springbootopenfeign.entity.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class UserController {

    @GetMapping("getUser")
    public User getUser(){
        log.info("模拟数据库请求数据");
        User user = new User();
        user.setId(1);
        user.setName("ZhangSan");
        return user;
    }


    @GetMapping("getHeaderName")
    public String getHeaderName(@RequestHeader("name")String name){
        log.info("获取请求头:"+name);
        return name;
    }


}

